/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hu
 * Date: 2024-05-06
 * Time: 20:46
 */
public class Test {
    public static int[] fib(int n){

        if(n <= 0){
            return null;
        }
        int[] array = new int[n];
        array[0] = array[1] = 1;
        for (int i = 2; i < n; ++i) {
            array[i] = array[i-1] + array[i-2];
        }
        return array;
    }
    public static void main(String[] args){
        int[] array = fib(20);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
    }
   /* public static int[] fib(int n){
        if(n <= 0){
            return null;
        }
        int[] array = new int[n];

    }*/
    /*public static int fib(int n){
        int cur = 0;
        int last2 = 1;
        int last1 = 1;
        for(int i = 3; i <= n; i++){
            cur = last1 +last2;
            last1 = last2;
            last2 = cur;
        }
        return cur;
    }

    public static void main(String[] args) {
        int ret = fib(20);
        System.out.println(ret);
    }*/
}
